package org.test.web.controller;

import cn.hutool.json.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.json.JSONException;
import org.springframework.web.bind.annotation.*;
import org.test.web.entity.GetUserHealthDataResponse;
import org.test.web.entity.MessageTypeResponse;
import org.test.web.entity.UserHealthData;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 功能描述
 *
 * @author: weiken
 * @date: 2023年10月26日 8:47
 */
@RestController
@RequestMapping("cloudring-property-mobile-web")
public class CloudringPropertyMobileWeb {
    @ResponseBody
    @RequestMapping("/myFamily/1.0/getUserHealthData")
    public GetUserHealthDataResponse getUserHealthData(@RequestBody(required = false) Map<String,Map<String,Object>> mapMap){
        GetUserHealthDataResponse userHealthDataResponse = new GetUserHealthDataResponse();
        userHealthDataResponse.setCode("200");
        GetUserHealthDataResponse.GetUserHealthData getUserHealthData = new GetUserHealthDataResponse.GetUserHealthData();
        getUserHealthData.setSex("男");
        getUserHealthData.setHeight("165");
        getUserHealthData.setBirthday("19840915");
        getUserHealthData.setWeight("140");
        userHealthDataResponse.setData(getUserHealthData);
        userHealthDataResponse.setMessage("请求成功");
        //System.out.println(mapMap.get("data").get("userId"));
        return userHealthDataResponse;
    }

    @RequestMapping("/userUnreadMessage")
    public MessageTypeResponse messageTypeResponse(){
        MessageTypeResponse messageTypeResponse = new MessageTypeResponse();
        messageTypeResponse.setCode("200");
        messageTypeResponse.setMessage("成功");
        MessageTypeResponse.DataEntity dataEntity = new MessageTypeResponse.DataEntity();
        MessageTypeResponse.DataEntity.ListEntity listEntity = new MessageTypeResponse.DataEntity.ListEntity();
        listEntity.setMsgType("familiy");
        listEntity.setIcon("icon");
        listEntity.setTypeName("typename");
        listEntity.setTitle("你好啊");
        listEntity.setSendTime("2006年08月01日 13:51:00");
        listEntity.setUnreadCount("11");
        dataEntity.setList(Arrays.asList(listEntity));
        messageTypeResponse.setData(dataEntity);
        return messageTypeResponse;
    }



}
